home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <powerup/ppclib/interface.h>
- #include <powerup/gcclib/powerup_protos.h>
- #include <powerup/ppcinline/exec.h>
-
- #define LOOP 10
-
- char Buffer[LOOP][256];
-
- /* Attention
- * You can share the Caos structure for asynchronus calls because
- * it`s copied to some internal buffer BUT you must be careful about
- * the data itself which is used.
- * In this case Buffer is the problem so you have to work around this
- * and do some asynchron buffer management.
- */
-
- int Function(APTR Function)
- {
- BPTR MyFile;
- struct Caos *MyCaos;
- ULONG DataArray[1];
- ULONG i;
- void *DOSBase;
- void *SysBase;
-
- if (MyFile=PPCOpen("con:0/0/640/200/CallOSASync/CLOSE/AUTO/WAIT",MODE_NEWFILE))
- {
- if (MyCaos = (struct Caos*) PPCAllocVec(sizeof(struct Caos),MEMF_PUBLIC|MEMF_CLEAR))
- {
- SysBase =(void*) *((ULONG*) 4L);
- if (DOSBase=(void*) OpenLibrary("dos.library",0))
- {
- for (i=0;i<LOOP;i++)
- {
- DataArray[0] = i;
-
- PPCRawDoFmt("Asynchron String %ld\n",
- &DataArray,
- 0, /* 0=Buffer,1=serial <> NOT supported yet */
- Buffer[i]);
-
-
- MyCaos->caos_Un.Offset = -0x30;
- MyCaos->d1 = (ULONG) MyFile;
- MyCaos->d2 = (ULONG) Buffer[i];
- MyCaos->d3 = strlen(Buffer[i]);
- MyCaos->a6 = (ULONG) DOSBase;
- MyCaos->M68kCacheMode = IF_CACHEFLUSHALL|IF_ASYNC;
- MyCaos->PPCCacheMode = IF_CACHEFLUSHALL;
- PPCCallOS(MyCaos);
- }
- }
- PPCFreeVec(MyCaos);
- }
- PPCClose(MyFile);
- return(1);
- }
- return(0);
- }
-